import QtQuick 2.4
import Qt.labs.controls 1.0
import QtQml.Models 2.2
import QtQuick.Layouts 1.1
import "../js/PersonalInfoNavigator.qml.js" as Jit
import "../template" as Tm

Tm.Navigator {
    id: nav
    title: "个人资料"
    property string uid: ""
    property string name: ""
    Component.onCompleted: {Jit.getInfo()}
    Flickable {
        id: flickable
        anchors.fill: parent
        contentWidth: parent.width
        contentHeight:720

        ScrollIndicator.vertical: ScrollIndicator { }
        Pane {
            anchors.fill: parent
            ColumnLayout {
                anchors.fill: parent

                Pane {
                    Layout.fillWidth: true

                    Layout.preferredHeight: 210

                    RowLayout {
                        anchors.centerIn: parent
                        anchors.horizontalCenterOffset: -24
                        ToolButton {
                            id: btn

                            label: Image {
                                id: image
                                anchors.centerIn: parent

                                onStatusChanged: {
                                    if (image.status == Image.Null || image.status == Image.Error)  {
                                        image.source ="../images/image_header.png"

                                    }
                                }
                            }

                            onClicked:  Jit.goImage()
                        }
                        ColumnLayout {
                            Label {
                                id: labelName
                            }

                            Label {
                                id: labelMobile
                            }
                        }
                    }
                }



                Pane {
                    Layout.fillHeight: true
                    Layout.fillWidth: true

                    GridLayout {
                        id: gridLayout
                        anchors.horizontalCenter: parent.horizontalCenter
                        columns: 2


                        Label {
                            text: "姓名"
                        }
                        TextField {
                            id: txtNick

                            readOnly: true
                        }

                        Label {
                            text: "手机"
                        }
                        TextField {
                            id: txtMobile

                            readOnly: true
                        }
                        Label {
                            text: "邮箱"

                        }
                        TextField {
                            id: txtMail

                            readOnly: true
                        }

                        Label {
                            text: "学校"
                        }
                        TextField {
                            text: usinfo.school.display
                            readOnly: true
                        }

                        Label {
                            text: "身份证"
                        }
                        TextField {
                            id: txtId

                            readOnly: true
                        }

                        Label {
                            text: "地址"
                        }
                        TextField {
                            id: txtAddress
                            text: usinfo.address
                            readOnly: true
                        }
                    }
                }
            }
        }
    }
}

